package routes

import (
	"github.com/gin-gonic/gin"
	"test_api/controllers/admin"
)

func AdminRoutersInit(r *gin.Engine) {
	adminRouters := r.Group("/admin")
	{

		adminRouters.GET("/login", func(c *gin.Context) {
			//c.JSON(200, gin.H{
			//	"message": "/admin/user",
			//})
			//(&admin.LoginController{}).Login(c)
			admin.LoginController{}.Login(c)
		})

		// 用户
		userRouters := adminRouters.Group("/user")
		{
			userRouters.GET("/get_user_info", admin.UserController{}.GetUserInfo)
			userRouters.GET("/add_user", admin.UserController{}.AddUser)
			userRouters.GET("/update_user", admin.UserController{}.UpdateUser)
		}

		// 订单控制器
		orderRouters := adminRouters.Group("/order")
		{
			orderRouters.GET("/get_list", func(c *gin.Context) {
				admin.OrderController{}.GetList(c)
			})
		}

	}
}
